//
//  DDMyGiftDetailTableViewCell.m
//  dingdang
//
//  Created by Jiangxp on 15/8/25.
//  Copyright (c) 2015年 阮 沧晖. All rights reserved.
//

#import "DDMyGiftDetailTableViewCell.h"

@implementation DDMyGiftDetailTableViewCell

- (void)awakeFromNib {
    // Initialization code
    _labTitle.backgroundColor = [UIColor clearColor];
    _labTitle.font = [UIFont systemFontOfSize:15.0f];
    _labTitle.textAlignment = NSTextAlignmentLeft;
    _labTitle.textColor = [UIColor grayColor];
    
    _labContent.backgroundColor = [UIColor clearColor];
    _labContent.font = [UIFont systemFontOfSize:16.0f];
    _labContent.textAlignment = NSTextAlignmentLeft;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

//赋值 and 自动换行,计算出cell的高度
-(void)setIntroductionText:(NSString*)text{
    //获得当前cell高度
    CGRect frame = [self frame];
    //文本赋值
    self.labContent.text = text;
    //设置label的最大行数
    self.labContent.numberOfLines = 10;
    CGSize size = CGSizeMake(300, 1000);
    CGSize labelSize = [self.labContent.text sizeWithFont:self.labContent.font constrainedToSize:size lineBreakMode:NSLineBreakByClipping];
    self.labContent.frame = CGRectMake(self.labContent.frame.origin.x, self.labContent.frame.origin.y, labelSize.width, labelSize.height);
    
    //计算出自适应的高度
    frame.size.height = labelSize.height+100;
    
    self.frame = frame;
}

@end
